import 'dart:async';

import 'leak/model/leak_node.dart';

class LeakStream {
  static LeakStream? _leakWatcherStream;

  LeakStream._();

  static LeakStream getInstance() {
    _leakWatcherStream ??= LeakStream._();

    return _leakWatcherStream!;
  }

  final StreamController<LeakNode> _streamController = StreamController.broadcast();

  void addLeakNode(LeakNode leakNode) {
    // _streamController.add(leakNode);
    _streamController.sink.add(leakNode);
  }

  void _closeStream() {
    _streamController.close();
  }

  Stream<LeakNode> get stream => _streamController.stream;
}
